package cn.wzc.crystal.iam.repository;

import cn.wzc.crystal.iam.entity.IamRole;
import org.springframework.data.jdbc.repository.query.Query;
import org.springframework.data.repository.CrudRepository;
import org.springframework.data.repository.query.Param;

import java.util.Set;

public interface RoleRepository extends CrudRepository<IamRole, Long> {

	@Query("select * from IAM_ROLE r  where r.ID in (select ur.ROLE_ID from iam_user_role ur where ur.USER_ID=:userId)")
	Set<IamRole> queryByUser(@Param("userId") Long userId);

}
